﻿/**
 * ...
 * @author wangjun
 */
class A2.btnEffect.uBtn
{
	
	public function uBtn() 
	{
		
	}
	
	static function dispose(btn){
		delete btn.onRollOut;
		delete btn.onRollOver;
		delete btn.onRelease;
		delete btn.onReleaseOutside;
		delete btn.onPress;		
	}
	static function kill(btn){
		dispose(btn);
	}
	static function del(btn){
		dispose(btn);
	}
	
	
	static function foo(btn) {			empty(btn);	} 
	static function dummy(btn) {		empty(btn);	} 
	static function empty(btn){	
		btn.onPress = function() {};
		btn.useHandCursor = false;
	}
	
	
	static function tempKill(btn) { record(btn); dispose(btn); }
	static function record(btn) {
		btn._onRollOut2 = btn.onRollOut;
		btn._onRollOver2 = btn.onRollOver;
		btn._onRelease2 = btn.onRelease;
		btn._onReleaseOutside2 = btn.onReleaseOutside;
		btn._onPress2 = btn.onPress; 
	}
	static function reback(btn) {
		btn.onRollOut = btn._onRollOut2;
		btn.onRollOver = btn._onRollOver2;
		btn.onRelease = btn._onRelease2;
		btn.onReleaseOutside = btn._onReleaseOutside2;
		btn.onPress = btn._onPress2;
		delete btn._onRollOut2;
		delete btn._onRollOver2;
		delete btn._onRelease2;
		delete btn._onReleaseOutside2;
		delete btn._onPress2;
	}
	static function getLastID(nm:String) {
		var a = nm.split('');
		for (var i = a.length; i>=0; i--) {
			if (!isNaN(a[i])) {
				var id = getLastID(nm.substring(0, i));
				if (id == null) {
					return Number(nm.substring(i, a.length));
				} else {
					return id+''+Number(nm.substring(i, a.length));
				}
			}
		}
		return null;
	}
}